/*
 * main.cc
 *
 *  Created on: Nov 18, 2010
 *      Author: fify
 */

/*
 * Note:
 * 1. Only ascending order allowed;
 * 2. The numbers can all be 1s or 2s.
 */
#include <iostream>
#include <stdio.h>
using namespace std;

int line[30005];

int main()
{
	int n;
	int temp;
	int res;

	scanf("%d", &n);

	line[0] = 0;

	for(int i = 1;i<=n;i++)
	{
		scanf("%d", &temp);
		line[i] = line[i-1] + (temp & 1);
	}

	res = 0x7fffffff;
	for(int i = 0;i<=n;i++)
	{
		res = min(res, i - line[i] + line[n] - line[i]);
	}

	printf("%d\n", res);
}
